package org.fujene.structure;

public class ContentInfo{
	private String[] binaryFlagNames;
	private String[] multipleFlagNames;
	private String[] contentNames;
	private String[] appendixNames;

	public ContentInfo(String[] content, String[] appendix, String[] binaryFlag, String[] multipleFlag){
		this.contentNames = content;
		this.appendixNames = appendix;
		this.binaryFlagNames = binaryFlag;
		this.multipleFlagNames = multipleFlag;
	}

	public String contentName(int index){
		if(index < contentNames.length) return contentNames[index];
		return null;
	}

	public int contentIndex(String str){
		if(str.equals("all")) return Integer.MAX_VALUE;
		for(int i = 0; i < contentNames.length; i++){
			if(contentNames[i].equalsIgnoreCase(str)) return i;
		}
		return -1;
	}

	public String appendixName(int index){
		if(index < appendixNames.length) return appendixNames[index];
		return null;
	}

	public int appendixIndex(String str){
		for(int i = 0; i < appendixNames.length; i++){
			if(appendixNames[i].equalsIgnoreCase(str)) return i;
		}

		return -1;
	}

	public String binaryFlagName(int index){
		if(index < binaryFlagNames.length) return binaryFlagNames[index];
		return null;
	}

	public int binaryFlagIndex(String str){
		for(int i = 0; i < binaryFlagNames.length; i++){
			if(binaryFlagNames[i].equalsIgnoreCase(str)) return i;
		}

		return -1;
	}

	public String multipleFlagName(int index){
		if(index < multipleFlagNames.length) return multipleFlagNames[index];
		return null;
	}

	public int multipleFlagIndex(String str){
		for(int i = 0; i < multipleFlagNames.length; i++){
			if(multipleFlagNames[i].equalsIgnoreCase(str)) return i;
		}

		return -1;
	}

	public int contentsNum(){
		return contentNames.length;
	}

	public int appendixNum(){
		return appendixNames.length;
	}

	public int binaryFlagNum(){
		return binaryFlagNames.length;
	}

	public int multipleFlagNum(){
		return multipleFlagNames.length;
	}

	public int totalNum(){
		return contentNames.length + appendixNames.length + binaryFlagNames.length + multipleFlagNames.length;
	}
}
